global root "/Volumes/Workgroup/Lab/Lab-heimb/Montenovo/Volunteering Paper/Data"
global results "$root/07_results/RR"
global dictionaries "$root/Dictionaries"


cd "$root"
use appended_analytic_010305111719, clear

xtile quantile_income=post_tax_income, nq(3)

*extensive, no fe
eststo extensive_margin_q1: reghdfe whether_volunteer_person  taxprice hourly_wage_aftertax full_time age sex  married black native_amer asian other hispanic HS some_college college_grad college_plus children religion rural if quantile_income==1, noabsorb vce(cluster state)
gen sample=e(sample)
bysort unique_id_crossys: gen nvals=_n==1
count if nvals==1 & sample==1
drop sample nvals

*extensive, yr fe
eststo extensive_margin_yrfe_q1: reghdfe whether_volunteer_person  taxprice hourly_wage_aftertax full_time age sex  married black native_amer asian other hispanic HS some_college college_grad college_plus children religion rural if quantile_income==1, absorb(year) vce(cluster state)
gen sample=e(sample)
bysort unique_id_crossys: gen nvals=_n==1
count if nvals==1 & sample==1
drop sample nvals

*extensive, year state fe
eststo extensive_margin_stfe_q1: reghdfe whether_volunteer_person  taxprice hourly_wage_aftertax full_time age sex  married black native_amer asian other hispanic HS some_college college_grad college_plus children religion rural if quantile_income==1, absorb(year state) vce(cluster state)
gen sample=e(sample)
bysort unique_id_crossys: gen nvals=_n==1
count if nvals==1 & sample==1
drop sample nvals

*extensive, year state individual fe
eststo extensive_margin_fe_q1: reghdfe whether_volunteer_person  taxprice hourly_wage_aftertax full_time age sex  married black native_amer asian other hispanic HS some_college college_grad college_plus children religion rural if quantile_income==1, absorb(year state unique_id_crossys) vce(cluster state)
gen sample=e(sample)
bysort unique_id_crossys: gen nvals=_n==1
count if nvals==1 & sample==1
drop sample nvals


drop if year==2010
drop if hours_volunteer_person==0

*intensive, no fe
eststo intensive_margin_q1: reghdfe hours_volunteer_person  taxprice hourly_wage_aftertax full_time age sex  married black native_amer asian other hispanic HS some_college college_grad college_plus children religion rural if quantile_income==1, noabsorb vce(cluster state)
gen sample=e(sample)
bysort unique_id_crossys: gen nvals=_n==1
count if nvals==1 & sample==1
drop sample nvals



*intensive, yr fe
eststo intensive_margin_yrfe_q1: reghdfe hours_volunteer_person  taxprice hourly_wage_aftertax full_time age sex  married black native_amer asian other hispanic HS some_college college_grad college_plus children religion rural if quantile_income==1, absorb(year) vce(cluster state)
gen sample=e(sample)
bysort unique_id_crossys: gen nvals=_n==1
count if nvals==1 & sample==1
drop sample nvals

*intensive, yr state fe
eststo intensive_margin_stfe_q1: reghdfe hours_volunteer_person  taxprice hourly_wage_aftertax full_time age sex  married black native_amer asian other hispanic HS some_college college_grad college_plus children religion rural if quantile_income==1, absorb(year state) vce(cluster state)
gen sample=e(sample)
bysort unique_id_crossys: gen nvals=_n==1
count if nvals==1 & sample==1
drop sample nvals

*intensive, year state individual fe
eststo intensive_margin_fe_q1: reghdfe hours_volunteer_person  taxprice hourly_wage_aftertax full_time age sex  married black native_amer asian other hispanic HS some_college college_grad college_plus children religion rural if quantile_income==1, absorb(year state unique_id_crossys) vce(cluster state)
gen sample=e(sample)
bysort unique_id_crossys: gen nvals=_n==1
count if nvals==1 & sample==1
drop sample nvals


cd "$results"

	 esttab extensive_margin_q1 extensive_margin_yrfe_q1 extensive_margin_stfe_q1 extensive_margin_fe_q1 using "preliminary_regress_extensive_q1.rtf", se star(* 0.10 ** 0.05 *** 0.01) replace se(a4) b(a3) title("Extensive Margin") addnotes("Outcome Variable: Whether person volunteered" "Col 1: No FE" "Col 2: Year FE" "Col 3: Year FE and State FE" "Col 4: Year, State, Individual FE") modelwidth(12) label cells(b(star fmt(3)) se(par fmt(3)))
	 
	 esttab intensive_margin_q1 intensive_margin_yrfe_q1 intensive_margin_stfe_q1 intensive_margin_fe_q1 using "preliminary_regress_intensive_q1.rtf", se star(* 0.10 ** 0.05 *** 0.01) replace se(a4) b(a3) title("Intensive Margin") addnotes("Outcome Variable: Total hours the person volunteered"  "Col 1: No FE" "Col 2: Year FE" "Col 3: Year FE and State FE" "Col 4: Year, State, Individual FE") modelwidth(12) label cells(b(star fmt(3)) se(par fmt(3)))
	 
//////////////////////////////////////////////////////////////////////////


cd "$root"
use appended_analytic_010305111719, clear

xtile quantile_income=post_tax_income, nq(3)

*extensive, no fe
eststo extensive_margin_q2: reghdfe whether_volunteer_person  taxprice hourly_wage_aftertax full_time age sex  married black native_amer asian other hispanic HS some_college college_grad college_plus children religion rural if quantile_income==2, noabsorb vce(cluster state)
gen sample=e(sample)
bysort unique_id_crossys: gen nvals=_n==1
count if nvals==1 & sample==1
drop sample nvals

*extensive, yr fe
eststo extensive_margin_yrfe_q2: reghdfe whether_volunteer_person  taxprice hourly_wage_aftertax full_time age sex  married black native_amer asian other hispanic HS some_college college_grad college_plus children religion rural if quantile_income==2, absorb(year) vce(cluster state)
gen sample=e(sample)
bysort unique_id_crossys: gen nvals=_n==1
count if nvals==1 & sample==1
drop sample nvals


*extensive, year state fe
eststo extensive_margin_stfe_q2: reghdfe whether_volunteer_person  taxprice hourly_wage_aftertax full_time age sex  married black native_amer asian other hispanic HS some_college college_grad college_plus children religion rural if quantile_income==2, absorb(year state) vce(cluster state)
gen sample=e(sample)
bysort unique_id_crossys: gen nvals=_n==1
count if nvals==1 & sample==1
drop sample nvals

*extensive, year state individual fe
eststo extensive_margin_fe_q2: reghdfe whether_volunteer_person  taxprice hourly_wage_aftertax full_time age sex  married black native_amer asian other hispanic HS some_college college_grad college_plus children religion rural if quantile_income==2, absorb(year state unique_id_crossys) vce(cluster state)
gen sample=e(sample)
bysort unique_id_crossys: gen nvals=_n==1
count if nvals==1 & sample==1
drop sample nvals


drop if year==2010
drop if hours_volunteer_person==0

*intensive, no fe
eststo intensive_margin_q2: reghdfe hours_volunteer_person  taxprice hourly_wage_aftertax full_time age sex  married black native_amer asian other hispanic HS some_college college_grad college_plus children religion rural if quantile_income==2, noabsorb vce(cluster state)
gen sample=e(sample)
bysort unique_id_crossys: gen nvals=_n==1
count if nvals==1 & sample==1
drop sample nvals

*intensive, yr fe
eststo intensive_margin_yrfe_q2: reghdfe hours_volunteer_person  taxprice hourly_wage_aftertax full_time age sex  married black native_amer asian other hispanic HS some_college college_grad college_plus children religion rural if quantile_income==2, absorb(year) vce(cluster state)
gen sample=e(sample)
bysort unique_id_crossys: gen nvals=_n==1
count if nvals==1 & sample==1
drop sample nvals

*intensive, yr state fe
eststo intensive_margin_stfe_q2: reghdfe hours_volunteer_person  taxprice hourly_wage_aftertax full_time age sex  married black native_amer asian other hispanic HS some_college college_grad college_plus children religion rural if quantile_income==2, absorb(year state) vce(cluster state)
gen sample=e(sample)
bysort unique_id_crossys: gen nvals=_n==1
count if nvals==1 & sample==1
drop sample nvals

*intensive, year state individual fe
eststo intensive_margin_fe_q2: reghdfe hours_volunteer_person  taxprice hourly_wage_aftertax full_time age sex  married black native_amer asian other hispanic HS some_college college_grad college_plus children religion rural if quantile_income==2, absorb(year state unique_id_crossys) vce(cluster state)
gen sample=e(sample)
bysort unique_id_crossys: gen nvals=_n==1
count if nvals==1 & sample==1
drop sample nvals


cd "$results"

	 esttab extensive_margin_q2 extensive_margin_yrfe_q2 extensive_margin_stfe_q2 extensive_margin_fe_q2 using "preliminary_regress_extensive_q2.rtf", se star(* 0.10 ** 0.05 *** 0.01) replace se(a4) b(a3) title("Extensive Margin") addnotes("Outcome Variable: Whether person volunteered" "Col 1: No FE" "Col 2: Year FE" "Col 3: Year FE and State FE" "Col 4: Year, State, Individual FE") modelwidth(12) label cells(b(star fmt(3)) se(par fmt(3)))
	 
	 esttab intensive_margin_q2 intensive_margin_yrfe_q2 intensive_margin_stfe_q2 intensive_margin_fe_q2 using "preliminary_regress_intensive_q2.rtf", se star(* 0.10 ** 0.05 *** 0.01) replace se(a4) b(a3) title("Intensive Margin") addnotes("Outcome Variable: Total hours the person volunteered"  "Col 1: No FE" "Col 2: Year FE" "Col 3: Year FE and State FE" "Col 4: Year, State, Individual FE") modelwidth(12) label cells(b(star fmt(3)) se(par fmt(3)))
	 
//////////////////////////////////////////////////////////////////////////


cd "$root"
use appended_analytic_010305111719, clear

xtile quantile_income=post_tax_income, nq(3)

*extensive, no fe
eststo extensive_margin_q3: reghdfe whether_volunteer_person  taxprice hourly_wage_aftertax full_time age sex  married black native_amer asian other hispanic HS some_college college_grad college_plus children religion rural if quantile_income==3, noabsorb vce(cluster state)
gen sample=e(sample)
bysort unique_id_crossys: gen nvals=_n==1
count if nvals==1 & sample==1
drop sample nvals

*extensive, yr fe
eststo extensive_margin_yrfe_q3: reghdfe whether_volunteer_person  taxprice hourly_wage_aftertax full_time age sex  married black native_amer asian other hispanic HS some_college college_grad college_plus children religion rural if quantile_income==3, absorb(year) vce(cluster state)
gen sample=e(sample)
bysort unique_id_crossys: gen nvals=_n==1
count if nvals==1 & sample==1
drop sample nvals

*extensive, year state fe
eststo extensive_margin_stfe_q3: reghdfe whether_volunteer_person  taxprice hourly_wage_aftertax full_time age sex  married black native_amer asian other hispanic HS some_college college_grad college_plus children religion rural if quantile_income==3, absorb(year state) vce(cluster state)
gen sample=e(sample)
bysort unique_id_crossys: gen nvals=_n==1
count if nvals==1 & sample==1
drop sample nvals

*extensive, year state individual fe
eststo extensive_margin_fe_q3: reghdfe whether_volunteer_person  taxprice hourly_wage_aftertax full_time age sex  married black native_amer asian other hispanic HS some_college college_grad college_plus children religion rural if quantile_income==3, absorb(year state unique_id_crossys) vce(cluster state)
gen sample=e(sample)
bysort unique_id_crossys: gen nvals=_n==1
count if nvals==1 & sample==1
drop sample nvals


drop if year==2010
drop if hours_volunteer_person==0

*intensive, no fe
eststo intensive_margin_q3: reghdfe hours_volunteer_person  taxprice hourly_wage_aftertax full_time age sex  married black native_amer asian other hispanic HS some_college college_grad college_plus children religion rural if quantile_income==3, noabsorb vce(cluster state)
gen sample=e(sample)
bysort unique_id_crossys: gen nvals=_n==1
count if nvals==1 & sample==1
drop sample nvals

*intensive, yr fe
eststo intensive_margin_yrfe_q3: reghdfe hours_volunteer_person  taxprice hourly_wage_aftertax full_time age sex  married black native_amer asian other hispanic HS some_college college_grad college_plus children religion rural if quantile_income==3, absorb(year) vce(cluster state)
gen sample=e(sample)
bysort unique_id_crossys: gen nvals=_n==1
count if nvals==1 & sample==1
drop sample nvals

*intensive, yr state fe
eststo intensive_margin_stfe_q3: reghdfe hours_volunteer_person  taxprice hourly_wage_aftertax full_time age sex  married black native_amer asian other hispanic HS some_college college_grad college_plus children religion rural if quantile_income==3, absorb(year state) vce(cluster state)
gen sample=e(sample)
bysort unique_id_crossys: gen nvals=_n==1
count if nvals==1 & sample==1
drop sample nvals

*intensive, year state individual fe
eststo intensive_margin_fe_q3: reghdfe hours_volunteer_person  taxprice hourly_wage_aftertax full_time age sex  married black native_amer asian other hispanic HS some_college college_grad college_plus children religion rural if quantile_income==3, absorb(year state unique_id_crossys) vce(cluster state)
gen sample=e(sample)
bysort unique_id_crossys: gen nvals=_n==1
count if nvals==1 & sample==1
drop sample nvals


cd "$results"

	 esttab extensive_margin_q3 extensive_margin_yrfe_q3 extensive_margin_stfe_q3 extensive_margin_fe_q3 using "preliminary_regress_extensive_q3.rtf", se star(* 0.10 ** 0.05 *** 0.01) replace se(a4) b(a3) title("Extensive Margin") addnotes("Outcome Variable: Whether person volunteered" "Col 1: No FE" "Col 2: Year FE" "Col 3: Year FE and State FE" "Col 4: Year, State, Individual FE") modelwidth(12) label cells(b(star fmt(3)) se(par fmt(3)))
	 
	 esttab intensive_margin_q3 intensive_margin_yrfe_q3 intensive_margin_stfe_q3 intensive_margin_fe_q3 using "preliminary_regress_intensive_q3.rtf", se star(* 0.10 ** 0.05 *** 0.01) replace se(a4) b(a3) title("Intensive Margin") addnotes("Outcome Variable: Total hours the person volunteered"  "Col 1: No FE" "Col 2: Year FE" "Col 3: Year FE and State FE" "Col 4: Year, State, Individual FE") modelwidth(12) label cells(b(star fmt(3)) se(par fmt(3)))
	 
//////////////////////////////////////////////////////////////////////////



cd "$root"
use appended_analytic_010305111719, clear

xtile quantile_income=post_tax_income, nq(3)

*extensive, no fe
eststo extensive_margin_q1: reghdfe whether_volunteer_person  taxprice post_tax_income hourly_wage_aftertax full_time age sex  married black native_amer asian other hispanic HS some_college college_grad college_plus children religion rural if quantile_income==1, noabsorb vce(cluster state)
gen sample=e(sample)
bysort unique_id_crossys: gen nvals=_n==1
count if nvals==1 & sample==1
drop sample nvals

*extensive, yr fe
eststo extensive_margin_yrfe_q1: reghdfe whether_volunteer_person  taxprice post_tax_income hourly_wage_aftertax full_time age sex  married black native_amer asian other hispanic HS some_college college_grad college_plus children religion rural if quantile_income==1, absorb(year) vce(cluster state)
gen sample=e(sample)
bysort unique_id_crossys: gen nvals=_n==1
count if nvals==1 & sample==1
drop sample nvals

*extensive, year state fe
eststo extensive_margin_stfe_q1: reghdfe whether_volunteer_person  taxprice post_tax_income hourly_wage_aftertax full_time age sex  married black native_amer asian other hispanic HS some_college college_grad college_plus children religion rural if quantile_income==1, absorb(year state) vce(cluster state)
gen sample=e(sample)
bysort unique_id_crossys: gen nvals=_n==1
count if nvals==1 & sample==1
drop sample nvals

*extensive, year state individual fe
eststo extensive_margin_fe_q1: reghdfe whether_volunteer_person  taxprice post_tax_income hourly_wage_aftertax full_time age sex  married black native_amer asian other hispanic HS some_college college_grad college_plus children religion rural if quantile_income==1, absorb(year state unique_id_crossys) vce(cluster state)
gen sample=e(sample)
bysort unique_id_crossys: gen nvals=_n==1
count if nvals==1 & sample==1
drop sample nvals


drop if year==2010
drop if hours_volunteer_person==0

*intensive, no fe
eststo intensive_margin_q1: reghdfe hours_volunteer_person  taxprice post_tax_income hourly_wage_aftertax full_time age sex  married black native_amer asian other hispanic HS some_college college_grad college_plus children religion rural if quantile_income==1, noabsorb vce(cluster state)
gen sample=e(sample)
bysort unique_id_crossys: gen nvals=_n==1
count if nvals==1 & sample==1
drop sample nvals



*intensive, yr fe
eststo intensive_margin_yrfe_q1: reghdfe hours_volunteer_person  taxprice post_tax_income hourly_wage_aftertax full_time age sex  married black native_amer asian other hispanic HS some_college college_grad college_plus children religion rural if quantile_income==1, absorb(year) vce(cluster state)
gen sample=e(sample)
bysort unique_id_crossys: gen nvals=_n==1
count if nvals==1 & sample==1
drop sample nvals

*intensive, yr state fe
eststo intensive_margin_stfe_q1: reghdfe hours_volunteer_person  taxprice post_tax_income hourly_wage_aftertax full_time age sex  married black native_amer asian other hispanic HS some_college college_grad college_plus children religion rural if quantile_income==1, absorb(year state) vce(cluster state)
gen sample=e(sample)
bysort unique_id_crossys: gen nvals=_n==1
count if nvals==1 & sample==1
drop sample nvals

*intensive, year state individual fe
eststo intensive_margin_fe_q1: reghdfe hours_volunteer_person  taxprice post_tax_income hourly_wage_aftertax full_time age sex  married black native_amer asian other hispanic HS some_college college_grad college_plus children religion rural if quantile_income==1, absorb(year state unique_id_crossys) vce(cluster state)
gen sample=e(sample)
bysort unique_id_crossys: gen nvals=_n==1
count if nvals==1 & sample==1
drop sample nvals


cd "$results"

	 esttab extensive_margin_q1 extensive_margin_yrfe_q1 extensive_margin_stfe_q1 extensive_margin_fe_q1 using "preliminary_regress_extensive_q1_inc.rtf", se star(* 0.10 ** 0.05 *** 0.01) replace se(a4) b(a3) title("Extensive Margin") addnotes("Outcome Variable: Whether person volunteered" "Col 1: No FE" "Col 2: Year FE" "Col 3: Year FE and State FE" "Col 4: Year, State, Individual FE") modelwidth(12) label cells(b(star fmt(3)) se(par fmt(3)))
	 
	 esttab intensive_margin_q1 intensive_margin_yrfe_q1 intensive_margin_stfe_q1 intensive_margin_fe_q1 using "preliminary_regress_intensive_q1_inc.rtf", se star(* 0.10 ** 0.05 *** 0.01) replace se(a4) b(a3) title("Intensive Margin") addnotes("Outcome Variable: Total hours the person volunteered"  "Col 1: No FE" "Col 2: Year FE" "Col 3: Year FE and State FE" "Col 4: Year, State, Individual FE") modelwidth(12) label cells(b(star fmt(3)) se(par fmt(3)))
	 
//////////////////////////////////////////////////////////////////////////


cd "$root"
use appended_analytic_010305111719, clear

xtile quantile_income=post_tax_income, nq(3)

*extensive, no fe
eststo extensive_margin_q2: reghdfe whether_volunteer_person  taxprice post_tax_income hourly_wage_aftertax full_time age sex  married black native_amer asian other hispanic HS some_college college_grad college_plus children religion rural if quantile_income==2, noabsorb vce(cluster state)
gen sample=e(sample)
bysort unique_id_crossys: gen nvals=_n==1
count if nvals==1 & sample==1
drop sample nvals

*extensive, yr fe
eststo extensive_margin_yrfe_q2: reghdfe whether_volunteer_person post_tax_income taxprice hourly_wage_aftertax full_time age sex  married black native_amer asian other hispanic HS some_college college_grad college_plus children religion rural if quantile_income==2, absorb(year) vce(cluster state)
gen sample=e(sample)
bysort unique_id_crossys: gen nvals=_n==1
count if nvals==1 & sample==1
drop sample nvals


*extensive, year state fe
eststo extensive_margin_stfe_q2: reghdfe whether_volunteer_person post_tax_income taxprice hourly_wage_aftertax full_time age sex  married black native_amer asian other hispanic HS some_college college_grad college_plus children religion rural if quantile_income==2, absorb(year state) vce(cluster state)
gen sample=e(sample)
bysort unique_id_crossys: gen nvals=_n==1
count if nvals==1 & sample==1
drop sample nvals

*extensive, year state individual fe
eststo extensive_margin_fe_q2: reghdfe whether_volunteer_person post_tax_income taxprice hourly_wage_aftertax full_time age sex  married black native_amer asian other hispanic HS some_college college_grad college_plus children religion rural if quantile_income==2, absorb(year state unique_id_crossys) vce(cluster state)
gen sample=e(sample)
bysort unique_id_crossys: gen nvals=_n==1
count if nvals==1 & sample==1
drop sample nvals


drop if year==2010
drop if hours_volunteer_person==0

*intensive, no fe
eststo intensive_margin_q2: reghdfe hours_volunteer_person  taxprice post_tax_income hourly_wage_aftertax full_time age sex  married black native_amer asian other hispanic HS some_college college_grad college_plus children religion rural if quantile_income==2, noabsorb vce(cluster state)
gen sample=e(sample)
bysort unique_id_crossys: gen nvals=_n==1
count if nvals==1 & sample==1
drop sample nvals

*intensive, yr fe
eststo intensive_margin_yrfe_q2: reghdfe hours_volunteer_person  taxprice post_tax_income hourly_wage_aftertax full_time age sex  married black native_amer asian other hispanic HS some_college college_grad college_plus children religion rural if quantile_income==2, absorb(year) vce(cluster state)
gen sample=e(sample)
bysort unique_id_crossys: gen nvals=_n==1
count if nvals==1 & sample==1
drop sample nvals

*intensive, yr state fe
eststo intensive_margin_stfe_q2: reghdfe hours_volunteer_person  taxprice post_tax_income hourly_wage_aftertax full_time age sex  married black native_amer asian other hispanic HS some_college college_grad college_plus children religion rural if quantile_income==2, absorb(year state) vce(cluster state)
gen sample=e(sample)
bysort unique_id_crossys: gen nvals=_n==1
count if nvals==1 & sample==1
drop sample nvals

*intensive, year state individual fe
eststo intensive_margin_fe_q2: reghdfe hours_volunteer_person  taxprice post_tax_income hourly_wage_aftertax full_time age sex  married black native_amer asian other hispanic HS some_college college_grad college_plus children religion rural if quantile_income==2, absorb(year state unique_id_crossys) vce(cluster state)
gen sample=e(sample)
bysort unique_id_crossys: gen nvals=_n==1
count if nvals==1 & sample==1
drop sample nvals


cd "$results"

	 esttab extensive_margin_q2 extensive_margin_yrfe_q2 extensive_margin_stfe_q2 extensive_margin_fe_q2 using "preliminary_regress_extensive_q2_inc.rtf", se star(* 0.10 ** 0.05 *** 0.01) replace se(a4) b(a3) title("Extensive Margin") addnotes("Outcome Variable: Whether person volunteered" "Col 1: No FE" "Col 2: Year FE" "Col 3: Year FE and State FE" "Col 4: Year, State, Individual FE") modelwidth(12) label cells(b(star fmt(3)) se(par fmt(3)))
	 
	 esttab intensive_margin_q2 intensive_margin_yrfe_q2 intensive_margin_stfe_q2 intensive_margin_fe_q2 using "preliminary_regress_intensive_q2_inc.rtf", se star(* 0.10 ** 0.05 *** 0.01) replace se(a4) b(a3) title("Intensive Margin") addnotes("Outcome Variable: Total hours the person volunteered"  "Col 1: No FE" "Col 2: Year FE" "Col 3: Year FE and State FE" "Col 4: Year, State, Individual FE") modelwidth(12) label cells(b(star fmt(3)) se(par fmt(3)))
	 
//////////////////////////////////////////////////////////////////////////


cd "$root"
use appended_analytic_010305111719, clear

xtile quantile_income=post_tax_income, nq(3)

*extensive, no fe
eststo extensive_margin_q3: reghdfe whether_volunteer_person  taxprice post_tax_income hourly_wage_aftertax full_time age sex  married black native_amer asian other hispanic HS some_college college_grad college_plus children religion rural if quantile_income==3, noabsorb vce(cluster state)
gen sample=e(sample)
bysort unique_id_crossys: gen nvals=_n==1
count if nvals==1 & sample==1
drop sample nvals

*extensive, yr fe
eststo extensive_margin_yrfe_q3: reghdfe whether_volunteer_person  taxprice post_tax_income hourly_wage_aftertax full_time age sex  married black native_amer asian other hispanic HS some_college college_grad college_plus children religion rural if quantile_income==3, absorb(year) vce(cluster state)
gen sample=e(sample)
bysort unique_id_crossys: gen nvals=_n==1
count if nvals==1 & sample==1
drop sample nvals

*extensive, year state fe
eststo extensive_margin_stfe_q3: reghdfe whether_volunteer_person  taxprice post_tax_income hourly_wage_aftertax full_time age sex  married black native_amer asian other hispanic HS some_college college_grad college_plus children religion rural if quantile_income==3, absorb(year state) vce(cluster state)
gen sample=e(sample)
bysort unique_id_crossys: gen nvals=_n==1
count if nvals==1 & sample==1
drop sample nvals

*extensive, year state individual fe
eststo extensive_margin_fe_q3: reghdfe whether_volunteer_person  taxprice post_tax_income hourly_wage_aftertax full_time age sex  married black native_amer asian other hispanic HS some_college college_grad college_plus children religion rural if quantile_income==3, absorb(year state unique_id_crossys) vce(cluster state)
gen sample=e(sample)
bysort unique_id_crossys: gen nvals=_n==1
count if nvals==1 & sample==1
drop sample nvals


drop if year==2010
drop if hours_volunteer_person==0

*intensive, no fe
eststo intensive_margin_q3: reghdfe hours_volunteer_person  taxprice post_tax_income hourly_wage_aftertax full_time age sex  married black native_amer asian other hispanic HS some_college college_grad college_plus children religion rural if quantile_income==3, noabsorb vce(cluster state)
gen sample=e(sample)
bysort unique_id_crossys: gen nvals=_n==1
count if nvals==1 & sample==1
drop sample nvals

*intensive, yr fe
eststo intensive_margin_yrfe_q3: reghdfe hours_volunteer_person  taxprice post_tax_income hourly_wage_aftertax full_time age sex  married black native_amer asian other hispanic HS some_college college_grad college_plus children religion rural if quantile_income==3, absorb(year) vce(cluster state)
gen sample=e(sample)
bysort unique_id_crossys: gen nvals=_n==1
count if nvals==1 & sample==1
drop sample nvals

*intensive, yr state fe
eststo intensive_margin_stfe_q3: reghdfe hours_volunteer_person  taxprice post_tax_income hourly_wage_aftertax full_time age sex  married black native_amer asian other hispanic HS some_college college_grad college_plus children religion rural if quantile_income==3, absorb(year state) vce(cluster state)
gen sample=e(sample)
bysort unique_id_crossys: gen nvals=_n==1
count if nvals==1 & sample==1
drop sample nvals

*intensive, year state individual fe
eststo intensive_margin_fe_q3: reghdfe hours_volunteer_person  taxprice post_tax_income hourly_wage_aftertax full_time age sex  married black native_amer asian other hispanic HS some_college college_grad college_plus children religion rural if quantile_income==3, absorb(year state unique_id_crossys) vce(cluster state)
gen sample=e(sample)
bysort unique_id_crossys: gen nvals=_n==1
count if nvals==1 & sample==1
drop sample nvals


cd "$results"

	 esttab extensive_margin_q3 extensive_margin_yrfe_q3 extensive_margin_stfe_q3 extensive_margin_fe_q3 using "preliminary_regress_extensive_q3_inc.rtf", se star(* 0.10 ** 0.05 *** 0.01) replace se(a4) b(a3) title("Extensive Margin") addnotes("Outcome Variable: Whether person volunteered" "Col 1: No FE" "Col 2: Year FE" "Col 3: Year FE and State FE" "Col 4: Year, State, Individual FE") modelwidth(12) label cells(b(star fmt(3)) se(par fmt(3)))
	 
	 esttab intensive_margin_q3 intensive_margin_yrfe_q3 intensive_margin_stfe_q3 intensive_margin_fe_q3 using "preliminary_regress_intensive_q3_inc.rtf", se star(* 0.10 ** 0.05 *** 0.01) replace se(a4) b(a3) title("Intensive Margin") addnotes("Outcome Variable: Total hours the person volunteered"  "Col 1: No FE" "Col 2: Year FE" "Col 3: Year FE and State FE" "Col 4: Year, State, Individual FE") modelwidth(12) label cells(b(star fmt(3)) se(par fmt(3)))
	 

	 
		 
	
	 
	